<?php
class SiteinfoModel extends Model{
	private $table;

	public function __construct(){
		parent::__construct();

		$this->table = C('db_table_prefix').'todo';
	}
	
	/**
	 * 获取站点信息
	 */
	public function getSiteInfo(){
		$siteInfo = array(
			//主机名
			'http_host' 	=> preg_replace('~^www\.~i', '', $_SERVER['HTTP_HOST']),
			//内存使用情况
			'memory_usage' 	=> $this->memory_usage(),
			//php版本
			'php_version'	=> PHP_VERSION,
			//操作系统
			'php_os'		=> PHP_OS,
			'license' 		=> $this->checkLicense(),
		);
		
		return $siteInfo;
	}
	
	/**
	 * 内存使用情况
	 */
	public function memory_usage(){
		$memory	 = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';

		return $memory;
	}
	
	/**
	 * 检测授权情况
	 */
	public function checkLicense(){
		$license = 0;
		return $license;
	} 
	
}